package com.doujiang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.doujiang.domain.Favorite;
import com.doujiang.mapper.FavoriteMapper;
import com.doujiang.service.IFavoriteService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 收藏/想看Service业务层处理
 * 
 * @author 王伟舰
 * @date 2025-07-19
 */
@Service
public class FavoriteServiceImpl extends ServiceImpl<FavoriteMapper, Favorite> implements IFavoriteService
{
    @Override
    public List<Favorite> getFavoritesByUserId(Long userId) {
        QueryWrapper<Favorite> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        queryWrapper.orderByDesc("created_at");
        return this.list(queryWrapper);
    }
}
